1. Field of the Present Invention
The present invention generally relates to the field of web-based applications and more particularly to a web server architecture that incorporates and optimizes elements typically implemented in kernel space to reduce context switching and produce a more efficient server.
2. History of Related Art
The Internet has become a medium for business and other applications, resulting in a commensurate proliferation of web-based services. Typically, web-based services are implemented by installing specialized software, referred to herein as a web server, on a server device that is connected to a network, whether it is a wide area network (WAN) such as the Internet or a local area network (LAN). A web server is accessed over the network from various client devices running client applications such as conventional web browsers that issue requests to web servers. A common example is a Hypertext Transfer Protocol (HTTP) formatted client request to retrieve and display a particular web page. The amount of time that expires between the time a client request is received by a server device and the time the server device sends an appropriate response back to the client reflects the performance of the web server.
Referring to FIG. 1, selected features of conventional web server architecture are depicted in block diagram format. In the depicted embodiment, a server device 100 includes various software components that work in conjunction with the actual web server application to handle client requests. A network interface 102 interacts with the network at the hardware level to receive client requests from the network. Upon receiving a client request, network interface 102 issues an interrupt to the operating system kernel 104. The kernel 104 must then suspend its current processing and invoke one or more network protocol routines indicated in FIG. 1 by the Transmission Control Protocol/Internet Protocol (TCP/IP) block 106. TCP/IP is a widely implemented suite of protocols that support networked computing on a large number of computer networks including the Internet. Among other functions, TCP/IP 106 extracts an HTTP formatted request from one or more received network packets. TCP/IP 106 then hands the extracted HTTP request to a web server application indicated by reference numeral 110.
To process an HTTP request, web server 110 is typically required to retrieve data by accessing a file system cache 122 via a file system 120. If the requested data is not present in file system cache 122, file system 120 may retrieve the data from disk. File system 120 then provides the retrieved data to web server 110. Web server 110 then accesses TCP/IP 106 to prepare the retrieved data for transmission over the network. This TCP/IP formatted response is then sent to the requesting client over the network via network interface 102.
Those knowledgeable in client-server software and server class operating systems will appreciate that the interrupt driven process described above suffers from excessive context switching that will undesirably limit server performance. Context switching refers generally to a change in state that occurs when a server processor switches from executing one process to another. Context switching is especially time consuming when an application program operating in user space invokes a process that executes in the kernel space, or vice versa. The user space and kernel space identify conceptual spaces defined by the operating system that have different levels of protection. Operating systems typically implement protection mechanisms to restrict access to the operating system's trusted core code. Because the bulk of the network communication code exists in kernel space, web server 110 must invoke kernel code frequently. Moreover, the generic or fully general TCP/IP code that resides in the kernel space is not optimized for web server processing. The generic code, for example, includes socket layer processing for general-purpose packet assembly and disassembly, but incurs some processing overhead. Because of the web server's wide spread prevalence in Internet applications, it would be highly desirable to implement a server that relied less heavily on operating system protected code and was optimized for processing specific types of network packets.